package com.huangfuyi.process.entity.mainthread;

import com.huangfuyi.process.actuator.enums.EPInstanceStatus;

import java.util.Map;

public class EPInstance {

    // 流程实例的id
    private final String id;

    // 流程实例的名称
    private final String name;

    // 流程模板的id
    private final String modelId;

    // 流程实例当前运行状态
    private final EPInstanceStatus status;

    // 流程实例当前运行的节点id
    private final String currentNodeId;

    // 流程实例当前运行的节点的运行信息id
    private final String currentRunningId;

    // 流程变量
    private final Map<String, Object> params;

    // 流程运行时信息，每个节点产生的运行信息会追加，需要注意持久层字段长度
    private String message;

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getModelId() {
        return modelId;
    }

    public EPInstanceStatus getStatus() {
        return status;
    }

    public String getCurrentNodeId() {
        return currentNodeId;
    }

    public String getCurrentRunningId() {
        return currentRunningId;
    }

    public Map<String, Object> getParams() {
        return params;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public EPInstance(String id, String name, String modelId, EPInstanceStatus status, String currentNodeId, String currentRunningId, Map<String, Object> params) {
        this.id = id;
        this.name = name;
        this.modelId = modelId;
        this.status = status;
        this.currentNodeId = currentNodeId;
        this.currentRunningId = currentRunningId;
        this.params = params;
    }

    public EPInstance(EPInstance instance, EPInstanceStatus status, String currentNodeId, String currentRunningId, Map<String, Object> params) {
        this.id = instance.getId();
        this.name = instance.getName();
        this.modelId = instance.getModelId();
        this.status = status;
        this.currentNodeId = currentNodeId;
        this.currentRunningId = currentRunningId;
        this.params = params;
    }
}
